ATSUCustomGrowFunc

Defines a pointer to a memory reallocation callback function. Your callback function manages memory reallocation operations typically handled by ATSUI.

typedef void * (*ATSUCustomGrowFunc)(void *refCon, void *oldBlock,
                    ByteCount oldSize, ByteCount newSize);

You would declare your function like this if you were to name it MyATSUCustomGrowFunc:

void * MyATSUCustomGrowFunc (
                     void *refCon,
                     void *oldBlock,
                     ByteCount oldSize,
                     ByteCount newSize);
refCon
A pointer to arbitrary data for use in your memory reallocation callback function. ATSUI passes a pointer to data that your application previously supplied in the memoryRefCon field of the ATSUMemoryCallbacks union.

oldBlock
An untyped pointer to the beginning of the block of memory you wish to reallocate. ATSUI passes this value to your application.

oldSize
The size (in bytes) of the memory you wish to reallocate. ATSUI passes this value to your application to indicate the number of bytes of memory you should copy if you need to allocate memory for the grown block.

newSize
The size (in bytes) of the new block of memory.

function result
An untyped pointer to the beginning address of the block of memory reallocated by your MyATSUCustomGrowFunc function.
DISCUSSION
You can register your callback function by calling the function ATSUCreateMemorySetting and passing the constant kATSUUseCallbacks in iHeapSpec and a pointer to the ATSUMemoryCallbacks union in iMemoryCallbacks. You then supply a pointer of type ATSUCustomGrowFunc in the Grow field of the callbacks structure of the ATSUMemoryCallbacks union.

Note that your MyATSUCustomGrowFunc function is expected to return a pointer to the start of the allocated memory, unless it terminates in an application.

VERSION NOTES
Available beginning with ATSUI 1.1.


© 2000 Apple Computer, Inc. – (Last Updated 25 Jan 00)